#141 change delayed_job.handler to mediumtext (16MB) like event.payload

This isn't a complete fix because if the event.payload is (say) exactly
16MB then the handler will be >16MB and the same problem will occur.

I'll push this in for now though, in practice it means it's much less
likely to occur.

Alex Piggott 10 年之前
父節點
當前提交
49b4fd89de
共有 1 個文件被更改,包括 19 次插入0 次删除
  1. 19 0
      db/migrate/20140127164931_change_handler_to_medium_text.rb

+ 19 - 0
db/migrate/20140127164931_change_handler_to_medium_text.rb

@@ -0,0 +1,19 @@
1
+# Increase handler size to 16MB (consistent with events.payload)
2
+
3
+class ChangeHandlerToMediumText < ActiveRecord::Migration
4
+  def up
5
+    if mysql?
6
+      change_column :delayed_jobs, :handler, :text, :limit => 16777215
7
+    end
8
+  end
9
+
10
+  def down
11
+    if mysql?
12
+      change_column :delayed_jobs, :handler, :text, :limit => 65535
13
+    end
14
+  end
15
+
16
+  def mysql?
17
+    ActiveRecord::Base.connection.adapter_name =~ /mysql/i
18
+  end
19
+end